using MediatR;
using SumerCoreDevOps.Application.Users.Commands;
using SumerCoreDevOps.Infrastructure.Identity;

namespace SumerCoreDevOps.Application.Users.Handlers;

/// <summary>
/// 解锁用户命令处理器
/// </summary>
public class UnlockUserCommandHandler : IRequestHandler<UnlockUserCommand>
{
    private readonly UserManager _userManager;

    public UnlockUserCommandHandler(UserManager userManager)
    {
        _userManager = userManager;
    }

    public async Task Handle(UnlockUserCommand request, CancellationToken cancellationToken)
    {
        await _userManager.UnlockUserAsync(request.UserId, request.UnlockedBy);
    }
}
